<html>
<head>
<script src="../../../jsonrpc_client.js" type="text/javascript"></script>
<script src="../../../introducer-compat.js" type="text/javascript"></script>
<style>
    .providerInstance {
        border: 1px #000 solid;
    }
</style>
<script type="text/javascript">
  function run() {
    initIntroducer(document.getElementById("introducer-frame").contentWindow);
  }
  
  function select(target) {
      introducer.request(document.body, ['application/message'], function(instance) {
          var pcontainer = document.createElement("div");
          pcontainer.className = "providerInstance";
          if (instance.iframe) {
              //pcontainer.appendChild(instance.iframe);
          } else {
              var newwin = document.createElement("span");
              newwin.innerHTML = "New Window Opened for Provider";
              pcontainer.appendChild(newwin);
          }
          var mbox = document.createElement("input");
          mbox.type = "text";
          var sendbut = document.createElement("button");
          sendbut.onclick = function() {
              instance.messagePort.postMessage(mbox.value);
          };
          pcontainer.appendChild(mbox);
          pcontainer.appendChild(sendbut);
          document.body.appendChild(pcontainer);
      });
      return false;
  }
</script>
  </head>
  <body onload="run()">
    <iframe width="0" height="0" src="../../../introducer-handler.html" id="introducer-frame"></iframe>
    <a onclick="select(this)" href="#">Load Message Receiver</a>
  </body>
</html>